package org.jili.novoland.base;

import android.graphics.Canvas;

public abstract class Layer {
    // protected int x = 0;
    // protected int y = 0;
    private int tileHeight, tileWidth;

    public int getTileHeight() {
        return tileHeight;
    }

    public int getTileWidth() {
        return tileWidth;
    }

    private int width = 0;
    private int height = 0;
    boolean visible = true;

    public Layer(int tileWidth, int tileHeight, int width, int height) {
        setSize(width, height);
        setTileSize(tileWidth, tileHeight);

    }

    public void setSize(int width, int height) {
        setWidth(width);
        setHeight(height);
    }

    public void setTileSize(int width, int height) {
        tileHeight = height;
        tileWidth = width;
    }

    // public void setPosition(int x, int y) {
    // this.x = x;
    // this.y = y;
    // }

    // public void move(int dx, int dy) {
    // x += dx;
    // y += dy;
    // }

    // public final int getX() {
    // return x;
    // }
    //
    // public final int getY() {
    // return y;
    // }

    public final int getWidth() {
        return width;
    }

    public final int getHeight() {
        return height;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public final boolean isVisible() {
        return visible;
    }

    public abstract void paint(int viewX, int viewY, Canvas c);

    void setWidth(int width) {
        if (width < 0) {
            throw new IllegalArgumentException();
        }
        this.width = width;
    }

    void setHeight(int height) {
        if (height < 0) {
            throw new IllegalArgumentException();
        }
        this.height = height;
    }

}
